WEBVTT

00:02.340 --> 00:07.680
Hello and welcome back to the costs on the last session we learned about basic data types like integers

00:07.740 --> 00:09.390
floats and strings.

00:09.690 --> 00:16.000
And also we learned about basic operations like addition multiplication and so on.

00:16.000 --> 00:19.710
And now in this session we are introducing where I was.

00:20.370 --> 00:22.020
So what is the variety.

00:22.050 --> 00:26.590
Let's assume we have an immediate object five.

00:26.760 --> 00:36.120
We can print it out and instead of having the five as the number itself we can assign a variety of let's

00:36.120 --> 00:37.470
call it a.

00:37.540 --> 00:38.900
So a equals five

00:41.760 --> 00:49.940
in Python now makes internally a reference that whenever we call a meets calculating five for its its

00:49.960 --> 00:50.860
returning five.

00:50.860 --> 00:54.730
So if we now just print a we are getting five.

00:55.000 --> 00:58.000
So A stands for five.

00:58.720 --> 01:04.930
And as we learned in the last session we can also print out a by calling the print function.

01:05.050 --> 01:14.290
So that's actually the same and we can also change the reference so if we say OK if I was five but now

01:14.320 --> 01:17.800
a seven we can just change it.

01:17.800 --> 01:22.680
So a seven and let's check if A's now seven and eight seven now.

01:22.690 --> 01:30.930
So we can simply change our reference so before our reference was to five to the integer object five

01:30.950 --> 01:32.970
and now a reference is to seven.

01:32.980 --> 01:37.350
So we can change for the reference all right.

01:37.370 --> 01:49.620
So let's introduce another variable let's call it B B equals 2 and we can also print out b b as to and

01:49.640 --> 01:55.730
then the last lesson we have learned that if you want to print out both A and B and one cell

01:59.180 --> 02:05.940
so by default to put a notebook only print out the last statement or the last line that's B here.

02:05.940 --> 02:09.930
So now if you want to print out both we have to call the print function

02:12.970 --> 02:15.480
and A and B.

02:16.480 --> 02:20.160
So now we can print out both 7 and 2.

02:20.570 --> 02:20.890
All right.

02:20.900 --> 02:26.870
So basically we can do with varietals the same as with integers or floats.

02:27.020 --> 02:41.770
We can do the basic operations like additions so we can take a plus b s nine A minus B S five B minus

02:41.860 --> 02:53.800
a minus five B can also multiply so A times B and we can of course we can also divide a divided by B

02:57.820 --> 03:02.830
and 0 for example we can assign the result of a divided by B

03:05.960 --> 03:10.430
so it's three point five we kind of can assign a new override but see to it.

03:10.850 --> 03:13.170
So C equals a divided by B.

03:14.300 --> 03:21.000
Let's print out C So c is three point five and we can also check the data type of C.

03:21.390 --> 03:24.880
So I would expect that it's a float.

03:25.020 --> 03:27.770
Yes exactly.

03:28.020 --> 03:33.560
And of course we cannot only assign over either to an integer or an end and float.

03:33.570 --> 03:37.050
We can also assign a rival to an end String object.

03:37.050 --> 03:47.260
So for example we have dark and we can assign the right of a d d equals stock and we can of course print

03:47.260 --> 03:48.430
out D so D.

03:48.850 --> 03:55.750
So internally a person makes a reference from the right a deed to our string object talk.

03:55.840 --> 04:01.530
So these stock and we can also check the data type of D.

04:03.120 --> 04:10.350
And it's a string so dark dog is a string of costs and the idea's referencing to talk and there's also

04:10.350 --> 04:17.700
a string then and former Ibo name we can actually make any name we we we want to have so we can say

04:18.270 --> 04:30.170
my favorite dog is Lassie for example and this works.

04:30.200 --> 04:39.140
Now if I want to print out my variable my favorite dog I can start typing my end by pressing the tab

04:39.170 --> 04:39.680
key.

04:41.300 --> 04:48.930
Supplies and automatically completes my where I ever saw my wife Leslie is oh that's called the tab

04:48.950 --> 04:51.940
completion supplies.

04:52.010 --> 04:55.150
Knows that a variable caught my favorite dog is start.

04:55.170 --> 05:04.090
Um yeah internally and whenever I start typing my then I can press tap and um yeah Python automatically

05:04.110 --> 05:07.420
um yeah completes my my arrival.

05:07.430 --> 05:11.320
So that's that's quite helpful actually when when the rivals.

05:11.320 --> 05:17.600
This is quite long like here in that case and I what I would also like to highlight this and that I

05:17.600 --> 05:19.510
need the under slash here.

05:19.520 --> 05:25.670
So if it's just a space my favorite dog so that's that cannot serve as a rival.

05:25.670 --> 05:29.470
So here it gives me an error message.

05:29.750 --> 05:36.150
So space space is not defined as us as part of a rival actually.

05:36.260 --> 05:37.700
So the only works in this way

05:43.740 --> 05:51.990
and also a string itself like let's say Doc a string like DA cannot be in our arrival so dark equals

05:52.080 --> 05:52.650
Spike

05:56.250 --> 05:58.830
gets me as well and an error message.

06:00.330 --> 06:03.060
N on into da float cannot be in viable.

06:03.070 --> 06:14.920
So let's say 5 equals Spike let's say it also doesn't work but an integer can be part often variety.

06:14.970 --> 06:19.840
So let's say dark 5 is a spike.

06:20.490 --> 06:21.270
So that works

06:27.850 --> 06:30.120
and that's one last thing I want to highlight here.

06:30.130 --> 06:35.590
So let's assume I assign to the variable E equals 10

06:38.960 --> 06:55.680
so we use 10 and then I assign F equals E Oh sorry F equals E sum this case f is 10 because E M and

06:55.680 --> 06:59.370
F equals E so f also must be 10.

06:59.700 --> 07:01.940
And now if I change E.

07:01.950 --> 07:07.380
So before you reference was a reference to the object 10.

07:07.620 --> 07:17.990
If I change e to let's say 15 and I again check the reference of F F is 13.

07:18.030 --> 07:21.360
Even if I before I referenced F equals E.

07:21.390 --> 07:28.150
So what happened internally so internally here and not object 10 was created and then reference.

07:28.260 --> 07:37.300
And it was reference to the variable e and here and we say F equals E then internally a reference to

07:37.300 --> 07:45.160
the same object 10 was created to F so we have one object an integer 10 and we have two references from

07:45.160 --> 07:54.880
tend to we and 2 F and if you change here the reference to 15 internally a new object 15 is created

07:55.120 --> 08:03.380
and the reference for you was changed from 10 to 15 but there was no impact on F so the reference from

08:03.380 --> 08:09.890
F is still to the integer object 10 not to 15 so that's that's quite important to understand due out

08:10.300 --> 08:13.780
how Python works internally all right.

08:13.800 --> 08:15.320
So that's it.

08:15.390 --> 08:16.650
So thank you very much.

08:16.650 --> 08:17.700
And um yeah.

08:17.700 --> 08:18.670
Hope you enjoyed it.

08:18.700 --> 08:20.310
And uh see you in the next lesson.
